<template>
  <h1>文件传到java服务器,然后由 java服务器传到七牛云</h1>
  <el-upload ref="uploadRef" action="http://localhost:8081/upload/qiniu"
             :auto-upload="false"
             :with-credentials="true"
             :on-success="upsuccess">
    <template #trigger>
      <el-button type="success">选择文件</el-button>
    </template>
    <el-button class="ml-4" type="success" @click="submitUpload">点击上传</el-button>
    <template #tip>
      <div class="el-upload__tip"></div>
    </template>
  </el-upload>

  <el-row>
    <el-col>
      <div class="block">
        <span class="demonstration">Custom</span>
        <el-image :src="upUrl">
          <template #placeholder>
            <div class="image-slot">Loading<span class="dot">...</span></div>
          </template>
        </el-image>
      </div>
    </el-col>
  </el-row>
</template>

<script setup>
import {ref, reactive, onMounted} from "vue";
import axios from '@/plugins/axios.js'
let upUrl = ref("")
const uploadRef=ref()
let submitUpload=()=>{
  uploadRef.value.submit()
}
let upsuccess = (response,file,fileList)=>{
  console.log(response)
  upUrl.value = response.data;
}

onMounted(() => {
});
</script>

<style scoped>

</style>